package com.qiuhui.spring_boot_03.Controller;

import java.lang.annotation.Annotation;

/**
 * @ClassName: PoetryAnnocation
 * @Description: TODO
 * @author: tian
 * @date: 2021/3/31  4:05 下午
 */
public class PoetryAnnotation {
    @Override
    @Poetry(id = 2,author = "李白",title = "将进酒")
    public String toString() {
        return "PoetryAnnotation{}";
    }

    public static void main(String[] args) {
        Class clazz = Poetry.class;
        Annotation[] annotations = clazz.getAnnotations();
        /**
         * 获取所有的注解
         * @java.lang.annotation.Target(value=[METHOD])
         * @java.lang.annotation.Retention(value=CLASS)
         * @java.lang.annotation.Documented()
         * @java.lang.annotation.Inherited()
         */
        for (Annotation annotation : annotations) {
            if (clazz.isAnnotation()){
                System.out.println(annotation);
            }
        }

    }
}
